package model

import (
	"gorm.io/gorm"
	"time"
)

type BaseModel struct {
	ID        int32          `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time      `gorm:"column:add_time" json:"-"`
	UpdatedAt time.Time      `gorm:"column:update_time" json:"-"`
	DeletedAt gorm.DeletedAt `json:"-"`
	IsDeleted bool           `json:"-"`
}

// 用户留言
type LeavingMessage struct {
	BaseModel
	UserId      int32  `gorm:"type:int;index"`
	MessageType int32  `gorm:"type:tinyint(1);comment:1(留言),2(投诉),3(询问),4(售后),5(求购)"`
	Subject     string `gorm:"type:varchar(100);comment:留言标题"`
	Message     string `gorm:"type:varchar(100);comment:留言内容"`
	File        string `gorm:"type:varchar(200);comment:留言图片"`
}

// 用户地址
type Address struct {
	BaseModel
	UserId       int32  `gorm:"type:int;index"`
	Province     string `gorm:"type:varchar(10);comment:省"`
	City         string `gorm:"type:varchar(10);comment:市"`
	District     string `gorm:"type:varchar(20);comment:区"`
	Address      string `gorm:"type:varchar(100);comment:详情地址"`
	SignerName   string `gorm:"type:varchar(20);comment:收件人"`
	SignerMobile string `gorm:"type:varchar(11);comment:收件人电话"`
}

// 用户收藏
type UserFav struct {
	BaseModel
	UserId  int32 `gorm:"type:int;index;idx_user_goods,unique"`
	GoodsId int32 `gorm:"type:int;index;idx_user_goods,unique"`
}
